package design.patterns.decorator.order;

/**
 * @Desc:   具体装饰类
 * @author: cww
 * @DateTime: 2020/6/10 11:25
 */

public class HeaderDecorator extends OrderDecorator{
    public HeaderDecorator(Order order) {
        super(order);
    }

    public void print(){
        // 提供私有打印方法
        this.printHeader();
        // 原有打印方法
        super.order.print();
    }

    private void printHeader(){
        System.out.println("\t***\tI N V O I C E\t***\nXYZ Incorporated\nDate of Sale: "
                + order.getSalesDate());
        System.out.println("========================================================");
        System.out.println("Item\t\tUnits\tUnit Price\tSubtotal");
    }
}
